﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace NullSuicide
{
    [Serializable()]
    class Player : IComparable<Player>
    {
        private string _Name;
        private int _Position;
        private int _OldPosition;
        private int _ID;
        private bool _InRaid;
        private List<LootItem> _Items;

        public Player(string name, int position) : this(-1, name, position, false) { }
        public Player(int ID, string name, int position) : this(ID, name, position, false) {}
        public Player(int ID, string name, int position, bool inRaid)
        {
            _ID = ID;
            _Name = name;
            _Position = position;
            _InRaid = inRaid;

            _Items = new List<LootItem>();
        }

        public List<LootItem> Items 
        {
            get { return _Items; }
            set { _Items = value; }
        }

        public string Name 
        {
            get { return _Name; } 
        }

        public int ID
        {
            set { _ID = ID; }
            get { return _ID; }
        }

        public int Position 
        { 
            get { return _Position; }
            set
            {
                _OldPosition = _Position;
                _Position = value;
            }
        }

        public bool InRaid
        { 
            get { return _InRaid; }
            set { _InRaid = value; }
        }

        #region IComparable Members

        public int CompareTo(Player otherPlayer)
        {
            return _Position.CompareTo(otherPlayer.Position);
        }

        #endregion
    }
}
